package cn.interestingshop.dao.goods;

import cn.interestingshop.dao.BaseDao;
import cn.interestingshop.model.entity.Goods;

import java.sql.SQLException;
import java.util.List;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2022/3/11 15:10
 **/
public class GoodsDaoImpl extends BaseDao<Goods> implements GoodsDao {
	@Override
	public List<Goods> findGoodByPage(int beginIndex, int showNum) {
		String sql = "SELECT\n" +
				"id,\n" +
				"goods_name,\n" +
				"goods_desc,\n" +
				"price,\n" +
				"stock,\n" +
				"classify_level1_id,\n" +
				"classify_level2_id,\n" +
				"classify_level3_id,\n" +
				"file_name,\n" +
				"is_delete\n" +
				"FROM\n" +
				"t_goods\n" +
				"LIMIT ?, ?";
		Object[] params = {beginIndex,showNum};
		try {
			return super.getResultList(sql, new Goods(), params);
		} catch (SQLException throwables) {
			throwables.printStackTrace();
		}
		return null;
	}
}
